package com.bz.websocket;

import com.bz.websocket.error.ErrorCode;

import java.util.Map;

/**
 * @author zhongyongbin
 * @since 2021/5/11
 */
public class ResponseProtocol{

    private int errorCode;

    private String errorMessage;

    private Map<String, Object> payload;

    public ResponseProtocol() {
    }

    public ResponseProtocol(int errorCode) {
        this.errorCode = errorCode;
    }

    public ResponseProtocol(int errorCode, String errorMessage) {
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public ResponseProtocol(ErrorCode errorCode) {
        this.errorCode = errorCode.getErrorCode();
        this.errorMessage = errorCode.getMessage();
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public Map<String, Object> getPayload() {
        return payload;
    }

    public void setPayload(Map<String, Object> payload) {
        this.payload = payload;
    }
}
